import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/cupertino.dart';

class HomeworkAnswerState implements Cloneable<HomeworkAnswerState> {
  String id;
  String name;
  String classEntityId;
  String status;
  String statuscn;
  String machineScore;
  String teacherScore;
  int practiceCount;

  // for answer mark editor
  int webPageProgress = 0;
  String remark = '';
  double rating1 = 0;
  double rating2 = 0;
  double rating3 = 0;
  TextEditingController contentEditController = TextEditingController();
  FocusNode focusNodeContent = FocusNode();
  TextEditingController scoreEditController = TextEditingController();
  FocusNode focusNodeScore = FocusNode();

  HomeworkAnswerState({
    this.id,
    this.name,
    this.classEntityId,
    this.status,
    this.statuscn,
    this.machineScore,
    this.teacherScore,
    this.practiceCount,
  });

  factory HomeworkAnswerState.fromJson(Map<String, dynamic> json) {
    return HomeworkAnswerState(
      id: json['id'],
      name: json['name'],
      classEntityId: json['classEntityId'],
      status: json['status'],
      statuscn: json['statuscn'],
      machineScore: json['machineScore'],
      teacherScore: json['teacherScore'],
      practiceCount: json['practiceCount'],
    );
  }

  @override
  HomeworkAnswerState clone() {
    return HomeworkAnswerState()
      ..webPageProgress = webPageProgress
      ..remark = remark
      ..rating1 = rating1
      ..rating2 = rating2
      ..rating3 = rating3
      ..contentEditController = contentEditController
      ..focusNodeContent = focusNodeContent
      ..scoreEditController = scoreEditController
      ..focusNodeScore = focusNodeScore
      ..id = id
      ..name = name
      ..classEntityId = classEntityId
      ..status = status
      ..statuscn = statuscn
      ..machineScore = machineScore
      ..teacherScore = teacherScore
      ..practiceCount = practiceCount;
  }

  @override
  String toString() {
    return 'HomeworkAnswerState{title: $name}';
  }
}

HomeworkAnswerState initState(HomeworkAnswerState args) {
  return args;
}
